package com.byb.server.service.util;

import com.byb.server.domain.Product;
import com.byb.server.repository.search.ProductSearchRepository;
import com.byb.server.service.dto.Product_sort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;

import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

public class SortByMoney implements SortStrategy {

    /**
     * 计算保费后，对保费排序
     * @param list
     * @param payment
     * @return
     */
    @Override
    public List<Product_sort> sortBy(List<Product_sort> list, List<Product> products, List<Product>data, Integer payment) {
//        return  SortUtil.filterProduct(list, products, payment).stream().sorted((a, b) -> b.getStrichen_money().compareTo(a.getStrichen_money()))
//            .collect(Collectors.toList());
        return  SortUtil.filterProduct(list, products ,data,payment);
    }
}
